import request from '@/util/request'
// mock
import requestMock from '@/util/requestMock'

//home页大banner图
export const reqMockBanner = ()=> requestMock({url:'/banner',method:'get'})
//楼层信息
export const reqMockFloor = ()=> requestMock({url:'/floor',method:'get'})

//typeNav列表
export const reqCategoryList = () => request({ url: '/product/getBaseCategoryList', method: 'get' })

//search页数据,data十个k
export const reqSearchList = data =>request({url:'/list',method:'post',data})

//商品详情页数据
export const reqDetailList = skuId =>request({url:`/item/${skuId}`,method:'get'})

// 添加购物车列表 或 修改购物车商品数量  
export const  reqAddCartSuccess = (skuId,skuNum) =>request({url:`/cart/addToCart/${ skuId }/${ skuNum }`,method:'post'})

//某一个用户的购物车
export const reqCartList = ()=> request({url:'/cart/cartList',method:'get'})

// 修改单个商品选中状态
export const updateChecked = (skuId,isChecked)=> request({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

//删除单个商品
export const deleteOne = (skuId)=>request({url:`/cart/deleteCart/${skuId}`,method:'delete'})

//发送验证码
export const reqGetUserCode = (phone)=>request({url:`/user/passport/sendCode/${phone}`,method:'get'});

// 用户注册
export const reqGetUserRejister = data => request({url:'/user/passport/register',method:'post',data})

//登录
export const reqUserLogin = data => request({url:'/user/passport/login',method:'post',data})

// 校验token
export const reqUserInfo = ()=>request({url:'/user/passport/auth/getUserInfo',method:'get'})

// 退出登录
export const reqLogout = ()=> request({url:'/user/passport/logout',method:'get'})

//获取交易页数据
export const reqTrade = ()=>request({url:'/order/auth/trade',method:'get'})

//pay支付
export const reqPay = (tradeNo,data)=>request({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data})

//提交订单
export const reqPayInfo = (orderId)=>request({url:`/payment/weixin/createNative/${orderId}`,method:'get'})

//查看订单支付状态
export const reqPayment = orderId => request({url:`/payment/weixin/queryPayStatus/${orderId}`,method:'get'})

//获取我的订单列表
export const reqOrder = (page,limit)=>request({url:`/order/auth/${page}/${limit}`,method:'get'})